local thbattle__yugi_guaili = fk.CreateSkill {

  name = "thbattle__yugi_guaili",

  tags = {},

}



thbattle__yugi_guaili:addEffect(fk.TargetSpecified, {
  anim_type = "offensive",
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(thbattle__yugi_guaili.name) and data.card and
    data.card.trueName == "slash"
  end,
  on_cost = function(self, event, target, player, data)
    return player.room:askForSkillInvoke(player, thbattle__yugi_guaili.name)
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local judge = {
      who = player,
      reason = thbattle__yugi_guaili.name,
      pattern = ".|.|.|.",
    }
    room:judge(judge)
    if judge.card.color == Card.Red then
      data.disresponsive = true
    elseif judge.card.color == Card.Black then
      room:addCardMark(data.card, "thbattle__yugi_guaili")
    end
  end,
})
thbattle__yugi_guaili:addEffect(fk.Damage, {
  anim_type = "offensive",
  can_trigger = function(self, event, target, player, data)
   return target == player and player:hasSkill(thbattle__yugi_guaili.name) and data.card and
          data.card.trueName == "slash"
          and data.to and not data.to.dead and not data.to:isNude() and
          data.card:getMark("thbattle__yugi_guaili") > 0
  end,
  on_cost = function(self, event, target, player, data)
    return true
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
     room:removeCardMark(data.card, "thbattle__yugi_guaili")
      local cards = room:askForCardsChosen(player, data.to, 1, 1, "he", thbattle__yugi_guaili.name)
      if #cards > 0 then
        room:throwCard(cards, thbattle__yugi_guaili.name, data.to, player)
      end
  end,
})

return thbattle__yugi_guaili
